package org.xwb.springcloud.messagetype.topic;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.stereotype.Component;
import org.xwb.springcloud.constant.MqConstant;

/**
 *
 * @author 10564
 */
@Component
public class TopicQueueConsumer {
    private static final Logger log = LoggerFactory.getLogger(TopicQueueConsumer.class);

    /**
     * 消费者one监听队列，并接收消息
     * @param message 消息内容
     */
    @RabbitListener(queues = MqConstant.TOPIC_QUEUE_ONE)
    public void receiveTopicQueueMessageOne(String message) {
        log.info("\n主题模式消费者01监听队列01-》路由键01 收到消息:{}\n",message);
    }

    /**
     * 消费者two监听队列，并接收消息
     * @param message 消息内容
     */
    @RabbitListener(queues = MqConstant.TOPIC_QUEUE_TWO)
    public void receiveTopicQueueMessageTwo(String message) {
        log.info("\n主题模式消费者02监听队列02-》路由键02 收到消息:{}\n",message);
    }
}
